package com.mms.utsc.smartnet;

import java.util.ArrayList;
import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class Schedule{
	private Date start;
	private Date end;
	private String day;
	private String coursecode;
	private int ID;
	
	public Schedule(String coursecode, String day, Date start, Date end) {
		this.coursecode = coursecode;
		this.start = start;
		this.end = end;
		this.day = day;
	}
	
	int getID(){
		return this.ID;
	}
	
	void setID(int ID){
		this.ID = ID;
	}
	
	Date getStartTime() {
		return start;
	}
	
	Date getEndTime() {
		return end;		
	}
	
	String getDay(){
		return day;
	}
	
	String getCourse() {
		return coursecode;
	}
	
	static ArrayList<Date> getHeadTailTimes(ArrayList<Schedule> schedule){
		ArrayList<Date> times = new ArrayList<Date>();
		Date earliest = schedule.get(0).getStartTime();
		Date latest = schedule.get(0).getEndTime();
		for(int i = 1; i < schedule.size(); i++){
			if(earliest.compareTo(schedule.get(0).getStartTime()) > 0)
				earliest = schedule.get(0).getStartTime();
			if(earliest.compareTo(schedule.get(0).getStartTime()) > 0)
				latest = schedule.get(0).getEndTime();
		}
		times.add(earliest);
		times.add(latest);
		return times;
	}
	
	@Override
	public String toString(){
		return coursecode;
		
	}
}
